<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@include file="/WEB-INF/view/common/common.jsp" %>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="${keywords}">
    <meta http-equiv="description" content="">
    <%@include file="/WEB-INF/view/common/head_css.jsp" %>
    <%@include file="/WEB-INF/view/common/head_css_startbootstrap.jsp" %>
    <%@include file="/WEB-INF/view/common/head_css_morris.jsp" %>
    <%@include file="/WEB-INF/view/common/head_css_treeview.jsp" %>
    <%@include file="/WEB-INF/view/common/head_css_datatables.jsp" %>
    <%@include file="/WEB-INF/view/common/head_css_fav.jsp" %>
    <%@include file="/WEB-INF/view/common/datepicker_css.jsp" %>
    <title>提现记录</title>
</head>
<body>
<div id="wrapper">
    <jsp:include page="/menu.html"></jsp:include>
    <div id="page-wrapper">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container-fluid">
                <div class="navbar-header">
                    <button type="button"
                            class="navbar-toggle animated flip pull-left"
                            data-toggle="collapse" data-target=".agent-navbar-collapse">
                        <span class="sr-only">Toggle navigation</span> <span
                            class="icon-bar"></span> <span class="icon-bar"></span> <span
                            class="icon-bar"></span>
                    </button>
                </div>
                <div class="collapse navbar-collapse agent-navbar-collapse" id="top-navbar-collapse">
                    <form class="navbar-form navbar-left" id="searchForm"
                          role="search" action="<c:url value='/cash/index.html'/>"
                          method="GET">
                        <div class="form-group">
                            <%--<label class="">用户名</label>--%>
                            <%--<input type="text" value="${parameter.entity.user.realName}" name="entity.realName" id="realName"--%>
                                   <%--autofocus class="typeahead form-control" placeholder="用户名">--%>
                            <%--<label class="">电话</label>--%>
                            <%--<input type="text" value="${parameter.entity.user.mobile}" name="entity.mobile" id="mobile"--%>
                                   <%--autofocus class="typeahead form-control" placeholder="电话">--%>
                                <label class="">预留手机号</label>
                                <input type="text" value="${parameter.entity.phone}" name="entity.phone" id="phone"
                                       autofocus class="typeahead form-control" placeholder="预留手机号">
                            <label class="">银行名称</label>
                            <input type="text" value="${parameter.entity.bankName}" name="entity.bankName" id="bankName"
                                   autofocus class="typeahead form-control" placeholder="银行名称">
                            <label class="">卡号</label>
                            <input type="text" value="${parameter.entity.cardNumber}" name="entity.cardNumber" id="cardNumber"
                                   autofocus class="typeahead form-control" placeholder="卡号">

                                <label class="">处理状态</label>
                                <select name="entity.status" id="status" class="form-control">
                                    <option value="">所有</option>
                                    <c:forEach items="${CashStatus}" var="s">
                                            <option value="${s}">
                                                    ${s.name}
                                            </option>
                                    </c:forEach>
                                </select>

                            <button type="submit" class="btn btn-primary" id="search"
                                    name="search">
                                <span class="glyphicon glyphicon-search searchBtn"></span>&nbsp;查询
                            </button>
                                <button type="submit" class="btn btn-primary" id="download"
                                        name="search">
                                    <span class="glyphicon glyphicon-search searchBtn"></span>&nbsp;下载
                                </button>
                        </div>
                    </form>
                    <%--<ul class="nav navbar-nav navbar-right" style="padding: 10px">--%>
                        <%--<li>--%>
                            <%--<button type="button"--%>
                                    <%--class="btn btn-primary navbar-btn addBtn">--%>
                        <%--<li class="fa fa-plus-square fa-fw"></li>--%>
                        <%--新增代理--%>
                        <%--</button></li>--%>

                        <%--&lt;%&ndash;<li style="margin-left: 10px">&ndash;%&gt;--%>
                        <%--&lt;%&ndash;<button type="button"&ndash;%&gt;--%>
                        <%--&lt;%&ndash;class="btn btn-danger navbar-btn noticeBtn">&ndash;%&gt;--%>
                        <%--&lt;%&ndash;<li class="fa fa-wechat"></li>&ndash;%&gt;--%>
                        <%--&lt;%&ndash;通知代理&ndash;%&gt;--%>
                        <%--&lt;%&ndash;</button></li>&ndash;%&gt;--%>
                        <%--<!-- <li><button type="button"--%>
                                <%--class="btn btn-primary navbar-btn transBtn">--%>
                                <%--<li class="fa fa-exchange fa-fw"></li>代理转让--%>
                            <%--</button></li> -->--%>
                    <%--</ul>--%>
                </div>
            </div>
        </nav>
        <div class="row">
            <div class="col-lg-12 col-md-12">
                <div class="table-responsive">
                    <table
                            class="table table-striped table-bordered table-hover table-condensed">
                        <thead>
                        <tr>
                            <th>选择</th>
                            <th>用户名</th>
                            <th>手机号</th>
                            <th>卡号</th>
                            <th>银行名称</th>
                            <th>支行信息</th>
                            <th>预留手机号</th>
                            <th>提现金额</th>
                            <%--<th>扣除手续费</th>--%>
                            <%--<th>兑换代金券</th>--%>
                            <%--<th>实时到账</th>--%>
                            <th>申请时间</th>
                            <th>状态</th>
                            <th>操作人/处理人</th>
                            <th>处理时间</th>
                            <th>未通过原因</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="dataList">
                        <c:forEach items="${list}" var="g">
                            <tr data-row="${l.id}">
                                <td><input type="checkbox" value="${l.id}"></td>
                                <td>${g.user.realName}</td>
                                <td>${g.user.mobile}</td>
                                <td>${g.cardNumber}</td>
                                <td>${g.bankName}</td>
                                <td>${g.subBranch}</td>
                                <td>${g.phone}</td>
                                <td>${g.amountMoney}</td>
                                <%--<td>${g.poundage}</td>--%>
                                <%--<td>${g.voucher}</td>--%>
                                <%--<td>${g.money}</td>--%>
                                <td>${g.createTime}</td>
                                <c:if test="${g.status.name eq '审核中'}">
                                    <td style="color: red">审核中</td>
                                </c:if>
                                <c:if test="${g.status.name eq '已通过'}">
                                    <td style="color: #1AA818">已通过</td>
                                </c:if>
                                <c:if test="${g.status.name eq '未通过'}">
                                    <td style="color: #2a6496">未通过</td>
                                </c:if>
                                <td>${g.name}</td>
                                <td>${g.handleTime}</td>
                                <td>${g.reason}</td>
                                <td>
                                    <c:if test="${g.status.name ne '未通过' && g.status.name ne '已通过'}">
                                        <a class="btn btn-success default editBtn"
                                           href="<c:url value='/cash/edit.html?id=${g.id}' /> "><span
                                                class="glyphicon glyphicon-wrench" aria-hidden="true"></span>审核</a>
                                    </c:if>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
                <jsp:include page="/WEB-INF/view/common/pager.jsp"></jsp:include>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
                        aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="myModalLabel"></h4>
            </div>
            <div class="modal-body" id="messageBody"></div>
            <div class="modal-footer"></div>
        </div>
    </div>
</div>

<div class="modal fade" id="selectModal" tabindex="-2" role="dialog" style="z-index:999999;"
     aria-labelledby="selectModalLabel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
                        aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="selectModalLabel"></h4>
            </div>
            <div class="modal-body" id="selectBody"></div>
            <div class="modal-footer"></div>
        </div>
    </div>
</div>


<div class="modal fade" id="myAlertModal" tabindex="-1" role="dialog" style="z-index:999999;"
     aria-labelledby="myModalLabel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
                        aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="myModalLabel"></h4>
            </div>
            <div class="modal-body" id="alertMessageBody"></div>
            <div class="modal-footer"></div>
        </div>
    </div>
</div>
<jsp:include page="/WEB-INF/view/common/head.jsp"></jsp:include>
<jsp:include page="/WEB-INF/view/common/datatables.jsp"></jsp:include>
<jsp:include page="/WEB-INF/view/common/startbootstrap.jsp"></jsp:include>
<jsp:include page="/WEB-INF/view/common/script_common.jsp"></jsp:include>
<jsp:include page="/WEB-INF/view/common/datepicker_js.jsp"></jsp:include>

<script src="https://cdn.bootcss.com/jquery-validate/1.16.0/jquery.validate.min.js"></script>
<script src="https://cdn.bootcss.com/jquery.form/4.2.1/jquery.form.min.js"></script>
<script type="text/javascript">
    $(function () {
        $(".addBtn").click(
            function (e) {
                e.preventDefault();
                e.stopPropagation();
                $("#myModal").load(
                    "<c:url value='/agent/edit.html'/>",
                    function (e) {
                        $('#myModal').modal({
                            backdrop: "static"
                        });
                    });
            });
        $("#download").click(function () {
            $("#searchForm").attr("action", "<c:url value='/cash/download.html'/>");
            $("#searchForm").submit();
        });

        $(".noticeBtn").click(
            function (e) {
                e.preventDefault();
                e.stopPropagation();
                $("#myModal").load(
                    "<c:url value='/agent/notice.html'/>",
                    function (e) {
                        $('#myModal').modal({
                            backdrop: "static"
                        });
                    });
            });

        $(".editBtn,.transBtn").click(function (e) {
            e.preventDefault();
            e.stopPropagation();
            $("#myModal").load($(this).attr("href"), function (e) {
                $('#myModal').modal({
                    backdrop: "static"
                });
            });
        });
        $("#dataList a.ajaxLink").click(function (e) {
            e.preventDefault();
            e.stopPropagation();
            var method = "POST";
            var action = $(this).attr("data-role");
            if (action == "delete") {
                if (!window.confirm("代理数据删除将不能恢复,是否继续?")) {
                    return false;
                }
                method = "DELETE";
            } else if (action == "active") {
                if (!window.confirm("将激活选定的代理,是否继续?")) {
                    return false;
                }
            } else if (action == "reorganize") {
                if (!window.confirm("将对选定的代理执行整顿操作,是否继续?")) {
                    return false;
                }
            }
            var that = $(this);
            $.ajax({
                url: $(that).attr("href"), method: method, complete: function (xhr, ts) {
                    if (xhr.status >= 200 && xhr.status < 300) {
                        var m = $.parseJSON(xhr.responseText);
                        if (m.flag == "0") {
                            $("#alertMessageBody").empty().html("操作成功完成");
                            $("#myAlertModal").modal({backdrop: "static", show: true});
                            window.setTimeout(function () {
                                $("#search").click();
                            }, 1500);

                        } else {
                            $("#alertMessageBody").empty().html("操作失败").addClass("text-danger");
                            $("#myAlertModal").modal({backdrop: "static", show: true});
                        }

                    } else {
                        $("#alertMessageBody").empty().html("操作失败").addClass("text-danger");
                        $("#myAlertModal").modal({backdrop: "static", show: true});
                    }
                }
            });
        });
        $("tbody tr[data-row]").each(function (index, row) {
            $(row).click(function (event) {
                if (event.target.nodeName != "INPUT") {
                    rowSelect($(this));
                }
                switchCss($(this));
            });
            $(row).bind("contextmenu", function () {
                return false;
            });
        });


        $("#datepicker.input-daterange").datepicker({
            autoclose: true,
            language: "zh-CN",
            todayHighlight: true,
            todayBtn: "linked",
            format: "yyyy-mm-dd",
            endDate: new Date()
        });

    });


</script>
</body>
</html>